import {articleAddToServer } from '@/api/apis.js'

// 定义数据变量
const user = {
  state: {
    // token: getToken(),
  },


  // 同步更新数据
  mutations: {
    // SET_TOKEN: (state, token) => {
    //   state.token = token
    // }
  },

  // 异步提交 mutation
  actions: {
    articleAddAction({commit}, formInfo) {
      return new Promise((resolve, reject) => {
        articleAddToServer(
          formInfo.articleTitle ,
          formInfo.isVisable ,
          formInfo.articleType ,
          formInfo.articleContent
        ).then( response => {

          console.log('发布结果------------------------'+response)
          resolve()
        }).catch( error => {
          reject(error)
        })


      })


    },


  }
}

export default user


